#!/usr/bin/env python
# -*- encoding: utf-8 -*-
'''
@File    :   user_schemas.py
@Time    :   2021/02/06 12:39:10
@Author  :   superjin
@Version :   1.0
'''

from typing import Optional,List
from datetime import datetime
from uuid import UUID
from pydantic import BaseModel, EmailStr, AnyHttpUrl, validator, Field
from core.schemas.base import BaseResponse

class ReservationCreate(BaseModel):
    classroomId :int
    reservationType :str
    participantUsers :List[int]
    reservationTime : List[str]
    description :str
    def get_times_as_datetimes(self):
        # 使用 strptime 解析特定格式的时间字符串
        return [datetime.strptime(time_str, "%Y-%m-%d %H:%M:%S") for time_str in self.reservationTime]

class ReservationDelete(BaseModel):
    reservationId :int
    
class ReservationUpdate(BaseModel):
    description: Optional[str] = None
    status: Optional[str]